create or replace view vac_page_rpt_4_1 as
with rpt as
(
select
  workspace,
  application_id,
  application_name,
  page_id,
  page_name,
  region_id,
  region_name,
  source_type,
  body_background_color,
  body_font_color,
  body_font_family,
  body_font_size,
  body_font_weight,
  border_color,
  to_char(border_width) border_width,
  format,
  format_item,
  page_header,
  page_header_alignment,
  page_header_font_color,
  page_header_font_family,
  page_header_font_size,
  page_header_font_weight,
  header_background_color,
  header_font_color,
  header_font_family,
  header_font_size,
  header_font_weight,
  to_char(height) height,
  orientation,
  output,
  print_server_override,
  output_file_name,
  content_disposition,
  document_header,
  output_link_text,
  show_output_link,
  footer,
  footer_alignment,
  footer_font_color,
  footer_font_family,
  footer_font_size,
  footer_font_weight,
  paper_size,
  paper_size_units,
  paper_size_width_units,
  to_char(paper_size_width) paper_size_width,
  component_comment,
  'APEX_APPLICATION_PAGE_RPT' src_view_name
from APEX_APPLICATION_PAGE_RPT
)
select workspace,
       application_id,
       application_name,
       page_id,
       page_name,
       region_name,
       region_id,
       U_NAME,
       U_VALUE,
       src_view_name
from rpt
UNPIVOT INCLUDE NULLS ( u_value
   FOR    u_name
   IN
   (
    source_type,
    body_background_color,
    body_font_color,
    body_font_family,
    body_font_size,
    body_font_weight,
    border_color,
    border_width,
    format,
    format_item,
    page_header,
    page_header_alignment,
    page_header_font_color,
    page_header_font_family,
    page_header_font_size,
    page_header_font_weight,
    header_background_color,
    header_font_color,
    header_font_family,
    header_font_size,
    header_font_weight,
    height,
    orientation,
    output,
    print_server_override,
    output_file_name,
    content_disposition,
    document_header,
    output_link_text,
    show_output_link,
    footer,
    footer_alignment,
    footer_font_color,
    footer_font_family,
    footer_font_size,
    footer_font_weight,
    paper_size,
    paper_size_units,
    paper_size_width_units,
    paper_size_width
   )
);

